//shader.h
#pragma once

struct fragment_shader_payload;
typedef Color (*fp_shader)(struct fragment_shader_payload* payload);

struct rasterize_info {
	//screen info
	int width;
	int height;

	/* Color.a : if set 255, sampled point, should draw it
	 * default Color.a is 0, no need care
	 * or add member: (now use Color.a )
	 * byte sampled[w*h] sync with frame buffer */
	Color* frame_buf;// rgba
	float* depth_buf; //z-buf

	Model model; //Model file data
	Image image; //image file data
	Image image2; //image file data

	Image* curImage; //current image
	fp_shader fShader; //current shader
};

struct fragment_shader_payload
{
	Vector3 view_pos;
	Vector3 color;
	Vector3 normal;
	Vector2 tex_coords;

	Image* pImage; //current image
	struct rasterize_info *raster;
};

struct light
{
    Vector3 position;
    Vector3 intensity;
};

extern Matrix get_view_matrix(Quaternion eye_pos);

extern Matrix get_model_matrix(float rotation_angle);

extern Matrix get_projection_matrix(float eye_fov, float aspect_ratio,
        float zNear, float zFar);

extern Color normal_fragment_shader(struct fragment_shader_payload* payload);
extern Color phong_fragment_shader(struct fragment_shader_payload* payload);
extern Color texture_fragment_shader(struct fragment_shader_payload* payload);

extern Color bump_fragment_shader(struct fragment_shader_payload* payload);

//displacement
extern Color disp_fragment_shader(struct fragment_shader_payload* payload);
